package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseLog;
import com.briup.recognition.bean.BaseLogExample;
import com.briup.recognition.dao.BaseLogMapper;
import com.briup.recognition.service.IBaseLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: charles
 * @create: 2021-03-28 15:11
 **/

@Service
public class BaseLogServiceImpl implements IBaseLogService {

    @Resource
    private BaseLogMapper baseLogMapper;

    @Override
    public List<BaseLog> query() {
        BaseLogExample example = new BaseLogExample();
        // 条件

        return baseLogMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(BaseLog greenhouse) {
        if(greenhouse.getId()!=null){
            baseLogMapper.updateByPrimaryKey(greenhouse);
        } else {
            baseLogMapper.insert(greenhouse);
        }
    }

    @Override
    public void deleteById(long id) {
        baseLogMapper.deleteByPrimaryKey(id);
    }
}
